import { isHidden } from './../../utils/index';
import { regExp } from '@/utils/regExp';
import {
  TableBase,
  TextTable,
  InputQuestion,
  UploadQuestion,
  QuestionBase,
  TimeQuestion,
  SelectQuestion,
  RadioQuestion,
  CustomTableQuestion,
  CkeditorQuestion,
  TitleQuestion,
  IconsQuestion
} from '@/components/public-template';
import { getMenNum } from '@/utils';
import { formInfoStore } from '@/store/modules/form';
import { reactive, computed } from 'vue';
const formStore = formInfoStore();

class HomeService {
  getLayerFormQuestions(isShow: boolean = false) {
    const questions: QuestionBase<any>[] = [
      new SelectQuestion({
        key: 'select1',
        label: '维修方式',
        required: true,
        hidden: isShow,
        value: 1,
        options: [
          {
            label: '请选择',
            value: null
          },
          {
            label: '内部维修',
            value: 1
          },
          {
            label: '委外维修',
            value: 2
          }
        ],
        type: 'text',
        state: {
          type: 'layer',
          changeOptions: {
            default: [getMenNum('startTime11', 'hidden', true)],
            1: [getMenNum('startTime11', 'hidden', true)],
            2: [getMenNum('startTime11', 'hidden', false)]
          }
        },
        order: 1
      }),

      new TimeQuestion({
        key: 'startTime11',
        label: '维修开始时间',
        value: '',
        hidden: !isShow,
        type: 'alone',
        required: true,
        state: {},
        order: 1
      })
    ];
    return questions.sort((a, b) => a.order - b.order);
  }

  getQuestions2() {
    formStore.setLayerQuestions(this.getLayerFormQuestions());
    const questions22: any = computed(() => formStore.getLayerQuestions);
    const questions: QuestionBase<any>[] = [
      new TitleQuestion({
        label: '页面详情',
        type: 'h3',
        state: {
          style: {
            'margin-bottom': '20px'
          }
        }
      }),

      new TitleQuestion({
        label: '维修结果'
      }),

      new IconsQuestion({
        // state: {
        //   style: { 'padding-left': '40px' },
        // },
        handle: [
          {
            key: 'layerTable',
            value: '弹层table',
            class: 'icon-attach',
            state: {
              table: this.getTables(),
              config: {
                type: 'layer',
                grid: 12, //分栏
                labelCol: 6,
                addUrl: 'subject/save',
                protType: 'post',
                title: '详情3',
                layout: 'inline',
                queryUrl: 'Course/GetAll',
                rowKey: 'id',
                name: 'layerTable',
                params: {},
                data: [
                  {
                    id: 1,
                    name1: '课程1',
                    name2: '张三',
                    name3: 1,
                    name4: 1663139464524,
                    name5: 1663139464524,
                    name6: 1663139464524,
                    name7: 1
                  },
                  {
                    id: 2,
                    name1: '课程1',
                    name2: '张三',
                    name3: 2,
                    name4: 1663139464524,
                    name5: 1663139464524,
                    name6: 1663139464524,
                    name7: 2
                  }
                ]
              }
            }
          },
          {
            key: 'layerFrom',
            value: '弹层form',
            class: 'icon-attach',
            state: {
              form: questions22,
              config: {
                type: 'layer',
                // grid: 12, //分栏
                // labelCol: 6,
                addUrl: 'subject/save',
                protType: 'post',
                title: '详情4',
                queryUrl: 'Course/GetAll',
                name: 'layerTable',
                params: {}
              }
            }
          }
        ]
      }),

      new SelectQuestion({
        key: 'code0',
        label: '维修结果',
        required: true,
        optios: [],
        placeholder: '请选中驱动',
        state: {
          url: 'system/subject/page',
          nameKey: 'nickName',
          nameValue: 'id',
          protType: 'post'
        },
        type: 'dictionary',
        value: ''
      }),

      new InputQuestion({
        key: 'code1',
        label: '故障维修',
        placeholder: '请输入故障部位',
        type: 'number',
        required: true,
        state: {
          grid: 12
        },
        value: ''
      }),

      new InputQuestion({
        key: 'code2',
        label: '维修工时(H)',
        placeholder: '请输入工时',
        type: 'text',
        required: true,
        value: ''
      }),

      new InputQuestion({
        key: 'code4',
        label: '维修措施',
        placeholder: '请选中驱动',
        type: 'textarea',
        required: true,
        state: {
          grid: 12
        },
        value: ''
      }),

      new InputQuestion({
        key: 'code5',
        label: '维修单号',
        type: 'textarea',
        required: true,
        state: {
          grid: 12
        },
        value: ''
      }),

      new UploadQuestion({
        key: 'backgroundImgUrl',
        label: '上传附件',
        // required: true,
        prompt: '请上传图片',
        // disabled: true,
        value: [
          'https://pics2.baidu.com/feed/0e2442a7d933c8951225c703a2e539fc83020075.jpeg@f_auto?token=a5a3b45e48121657a85be495c1f289e9',
          'https://pics2.baidu.com/feed/0e2442a7d933c8951225c703a2e539fc83020075.jpeg@f_auto?token=a5a3b45e48121657a85be495c1f289e9',
          'https://pics2.baidu.com/feed/0e2442a7d933c8951225c703a2e539fc83020075.jpeg@f_auto?token=a5a3b45e48121657a85be495c1f289e9',
          'https://pics2.baidu.com/feed/0e2442a7d933c8951225c703a2e539fc83020075.jpeg@f_auto?token=a5a3b45e48121657a85be495c1f289e9'
        ],
        state: {
          // tip: '建议上传宽为750的图片尺寸',
          // multiple: true //开启多个上传
          //   multiple:true,
          //   maxCount:10,
          grid: 24
          // fullLine: false //占整行
          // width: '50%'
        },
        order: 6
      }),

      new UploadQuestion({
        key: 'backgroundImgUrl2',
        label: '上传附件',
        // required: true,
        prompt: '请上传图片',
        // disabled: true,
        value: [
          'https://pics2.baidu.com/feed/0e2442a7d933c8951225c703a2e539fc83020075.jpeg@f_auto?token=a5a3b45e48121657a85be495c1f289e9',
          'https://pics2.baidu.com/feed/0e2442a7d933c8951225c703a2e539fc83020075.jpeg@f_auto?token=a5a3b45e48121657a85be495c1f289e9',
          'https://pics2.baidu.com/feed/0e2442a7d933c8951225c703a2e539fc83020075.jpeg@f_auto?token=a5a3b45e48121657a85be495c1f289e9',
          'https://pics2.baidu.com/feed/0e2442a7d933c8951225c703a2e539fc83020075.jpeg@f_auto?token=a5a3b45e48121657a85be495c1f289e9'
        ],
        state: {
          // tip: '建议上传宽为750的图片尺寸',
          // multiple: true //开启多个上传
          //   multiple:true,
          //   maxCount:10,
          grid: 24
          // fullLine: false //占整行
          // width: '50%'
        },
        order: 6
      }),

      new CkeditorQuestion({
        key: 'conent',
        value: '',
        order: 6,
        state: {
          grid: 24,
          fullLine: false //占整行
        }
      }),

      new TitleQuestion({
        label: '',
        type: 'slot',
        state: {
          slotName: 'tableSlot'
        }
      }),

      new CustomTableQuestion({
        key: 'sparePartList1',
        label: '',
        value: [
          {
            name1: 1,
            name2: 2,
            name3: 3,
            name4: 2,
            name5: 2,
            name6: 2,
            name7: 2,
            name8: 2,
            name9: 2,
            name10: 2,
            name11: 2,
            name12: 2,
            name13: 2,
            name14: 2,
            name15: 123
          }
        ],
        type: 'text',
        state: {
          grid: 24,
          fullLine: true, //占整行
          // widthTable: '1000px',
          // style: { 'padding': '0px 40px' },
          // isAdd: false,
          columns: [
            {
              title: '人员（元）',
              key: 'name1',
              type: 'input',
              required: true
            },
            {
              title: '材料（元）',
              key: 'name2',
              type: 'input',
              required: true
            },
            {
              title: '备件耗材（元）',
              key: 'name3',
              type: 'input',
              required: true
            },
            {
              title: '其他（元）',
              key: 'name4',
              type: 'input',
              required: true
            },
            {
              title: '总计（元）',
              key: 'name1',
              type: 'input',
              required: true
            }
          ]
        },
        order: 1
      }),

      new CustomTableQuestion({
        key: 'sparePartList1',
        label: '委托消耗备材',
        value: [
          {
            name1: 1,
            name2: 2,
            name3: 3,
            name4: 2,
            name5: 2,
            name6: 2,
            name7: 2,
            name8: 2,
            name9: 2,
            name10: 2,
            name11: 2,
            name12: 2,
            name13: 2,
            name14: 2,
            name15: 123
          }
        ],
        type: 'text',
        state: {
          grid: 24,
          fullLine: true, //占整行
          // widthTable: '1000px',
          // style: { 'padding': '0px 40px' },
          isAdd: true,
          columns: [
            {
              title: '备件名称',
              key: 'name1',
              type: 'input',
              required: true
            },
            {
              title: '使用数量',
              key: 'name2',
              type: 'select',
              state: {
                onRepeat: true, //当前列的选项不重复
                url: 'system/subject/page',
                nameKey: 'nickName',
                nameValue: 'id',
                protType: 'post'
              },
              required: true
            },
            {
              title: '使用数量',
              key: 'name3',
              type: 'select',
              required: true
            },
            {
              title: '总价（元）',
              key: 'name4',
              type: 'input'
            },
            {
              title: '操作',
              type: 'operation',
              handle: [
                {
                  type: 'delete',
                  text: '删除'
                }
              ],
              width: 200
            }
          ]
        },
        order: 1
      })
    ];
    return questions;
  }

  getQuestions() {
    const questions: QuestionBase<any>[] = [
      new SelectQuestion({
        key: 'select1',
        label: '维修方式',
        required: true,
        value: null,
        disabled: true,
        options: [
          {
            label: '请选择',
            value: null
          },
          {
            label: '内部维修',
            value: 1
          },
          {
            label: '委外维修',
            value: 2
          }
        ],
        type: 'text',
        state: {
          title: '预维修登记'
        },
        order: 1
      }),

      new TimeQuestion({
        key: 'startTime',
        label: '维修开始时间',
        value: '',
        type: 'alone',
        required: true,
        state: {},
        order: 1
      }),

      new SelectQuestion({
        key: 'select2',
        label: '维修类型',
        required: true,
        value: null,
        options: [
          {
            label: '请选择',
            value: null
          },
          {
            label: '技改',
            value: 1
          },
          {
            label: '大修',
            value: 2
          },
          {
            label: '异常维修',
            value: 3
          }
        ],
        type: 'text',
        order: 1
      }),

      new InputQuestion({
        key: 'slot',
        label: '插槽',
        value: '333',
        type: 'slot',
        state: {
          slotName: 'slotName',
          extendParams: {
            extendObj: {
              value1: ''
            }
          }
        },
        order: 1
      }),

      new RadioQuestion({
        key: 'select3',
        label: '维修类型',
        value: 1,
        options: [],
        type: 'dictionary',
        state: {
          filterName: 'auditType'
        },
        order: 1
      }),

      new TimeQuestion({
        key: 'startTime2',
        label: '预计完成时间',
        value: '',
        type: 'alone',
        required: true,
        state: {},
        order: 1
      }),

      new UploadQuestion({
        key: 'file',
        label: '上传附件',
        value: [],
        state: {
          tip: '支持扩展名：.rar .zip .doc .docx .pdf .jpg...',
          multiple: true,
          maxCount: 3,
          listType: 'text'
        }
      }),

      new CustomTableQuestion({
        key: 'customTable',
        label: '自定义table',
        value: [
          {
            name1: '',
            name2: '',
            name3: '',
            name4: '',
            name5: '',
            name6: ''
          }
        ],
        type: 'text',
        state: {
          grid: 24,
          fullLine: true, //占整行
          isAdd: true,
          columns: [
            {
              title: '行号',
              key: 'name1'
            },
            {
              title: '品牌',
              key: 'name3'
            },
            {
              title: '备件编码',
              key: 'name5',
              type: 'time',
              state: {
                format: 'HH:mm:ss'
              },
              width: 150
            },
            {
              title: '规格型号',
              key: 'name6',
              type: 'select',
              options: [
                {
                  value: 'jack',
                  label: 'Jack'
                },
                {
                  value: 'lucy',
                  label: 'Lucy'
                }
              ],
              width: 150
            },
            {
              title: '申领数量',
              key: 'name7'
            },
            {
              title: '单位',
              key: 'name8',
              type: 'disable'
            },
            {
              title: '操作',
              type: 'operation',
              width: 100
            }
          ]
        },
        order: 1
      })
    ];
    return questions.sort((a, b) => a.order - b.order);
  }

  getTables() {
    const tables: TableBase<any>[] = [
      new TextTable({
        key: 'name1',
        value: '节点名称',
        type: 'router',
        state: {
          type: 'url',
          url: 'DemoDetails',
          params: [{ id: 'id' }]
        },
        order: 1
      }),

      new TextTable({
        key: 'maintenanceStatus',
        value: '维护状态',
        type: 'dictionary',
        state: {
          filterName: 'WORK_CELL_MAINTENANCE_STATUS'

          //下面不要
          // url: 'system/dict/info/listByTypeKey',
          // nameKey: 'dvalue',
          // nameValue: 'dkey',
          // protType: 'post',
          // params: {
          //   dkey: 'WORK_CELL_MAINTENANCE_STATUS'
          // }
        }
      }),
      new TextTable({
        key: 'name2',
        value: '审批人',
        order: 1
      }),

      new TextTable({
        key: 'img',
        value: '',
        type: 'img',
        state: {
          width: '200px'
        },
        order: 1
      }),

      new TextTable({
        key: 'name3',
        value: '审批操作',
        type: 'custom', //本地自定义
        columns: {
          customRender: (data: any) => {
            const result = `${data.value === 1 ? '同意' : '不同意'}`;
            return result;
          }
        },
        scopedSlots: { customRender: 'recordName' },
        order: 4
      }),

      new TextTable({
        key: 'name4',
        value: '本地插槽',
        type: 'slot',
        state: {
          fillPadding: true,
          slotName: 'slotName'
        },
        order: 4
      }),

      new TextTable({
        key: 'name5',
        value: '办结时间',
        type: 'time',
        order: 4
      }),

      new TextTable({
        key: 'name6',
        value: '耗时',
        type: 'time',
        order: 4
      }),

      new TextTable({
        key: 'name7',
        value: '审批意见',
        type: 'dictionary',
        state: {
          filterName: 'auditType'
        },
        order: 4
      })
    ];

    return tables.sort((a, b) => a.order - b.order);
  }

  getTables4() {
    const tables: TableBase<any>[] = [
      new TextTable({
        key: 'name1',
        value: '行号',
        order: 1
      }),

      new TextTable({
        key: 'name2',
        value: '品牌',
        type: 'slot',
        columns: {
          width: 400
        },
        state: {
          slotName: 'name2'
        },
        order: 1
      }),

      new TextTable({
        key: 'name3',
        value: '类型',
        type: 'custom', //本地自定义
        columns: {
          customRender: (data: any) => {
            const result = `${data.value === 1 ? '运动部件类' : '非运动部件类'}`;
            return result;
          }
        },
        scopedSlots: { customRender: 'recordName' },
        order: 4
      }),

      new TextTable({
        key: 'name4',
        value: '备件名称',
        controlType: 'select',
        order: 4,
        type: 'dictionary',
        state: {
          filterName: 'SECRET_LEVEL'
        }
        // options: [
        //   {
        //     value: 'jack',
        //     label: 'Jack'
        //   },
        //   {
        //     value: 'lucy',
        //     label: 'Lucy'
        //   }
        // ]
      }),

      new TextTable({
        controlType: 'input',
        key: 'name5',
        value: '备件编码',
        order: 4
      }),

      new TextTable({
        key: 'name6',
        value: '规格型号',
        order: 4
      }),

      new TextTable({
        key: 'name7',
        value: '申领数量',
        order: 4
      }),

      new TextTable({
        key: 'name8',
        value: '单位',
        order: 4
      }),

      new TextTable({
        key: 'name9',
        value: '审核状态',
        type: 'dictionary',
        state: {
          filterName: 'auditType'
        },
        order: 4
      }),

      new TextTable({
        key: 'name10',
        value: '申请时间',
        type: 'time',
        order: 4
      })
    ];

    return tables.sort((a, b) => a.order - b.order);
  }

  getTablesExpanded() {
    const tables: TableBase<any>[] = [
      new TextTable({
        key: 'name1',
        value: '行号',
        order: 1
      }),

      new TextTable({
        key: 'name2',
        value: '品牌',
        order: 1
      }),

      new TextTable({
        key: 'name3',
        value: '审核状态',
        type: 'dictionary',
        state: {
          filterName: 'auditType'
        },
        order: 4
      }),

      new TextTable({
        key: 'name4',
        value: '申请时间',
        type: 'time',
        order: 4
      })
    ];

    return tables.sort((a, b) => a.order - b.order);
  }

  getTables5() {
    const tables: TableBase<any>[] = [
      new TextTable({
        key: 'name1',
        value: '行号',
        type: 'slot',
        state: {
          slotName: 'name1'
        },
        order: 1
      })
    ];

    return tables.sort((a, b) => a.order - b.order);
  }

  getIcons() {
    const icons: TableBase<any>[] = [
      new TextTable({
        key: 'local',
        value: '添加',
        class: 'icon-add',
        state: {
          url: 'DemoDetails',
          key: ''
        },
        order: 1
      }),
      new TextTable({
        key: 'upload',
        value: '导入',
        class: 'icon-cloud-upload',
        // type: 'ghost',
        state: {
          url: 'subject/importSubject',
          title: '用户上传',
          key: '',
          downloadUrl: 'pdm/material/export/1',
          downloadFileName: '导入模版',
          downloadName: '下载模版',
          downloadRule: '2、仅允许上传excel格式；文件大小不超过10M'
        },
        order: 1
      })
    ];

    return icons.sort((a, b) => a.order - b.order);
  }

  getQuestions6() {
    const questions: QuestionBase<any>[] = [
      new TitleQuestion({
        label: '基本信息',
        state: {
          icon: 'icon-help-circle',
          iconHint: '我是提示'
        }
      }),
      new SelectQuestion({
        key: 'folderId',
        label: '存放地点',
        value: null,
        type: 'tree',
        state: {
          url: 'dms/archives/folder/tree',
          protType: 'post',
          nameKey: 'name',
          nameValue: 'id',
          nameChildren: 'children',
          params: {
            // dkey: 'folderId'
          }
        }
      }),
      new SelectQuestion({
        key: 'name1',
        label: '业务类型',
        required: true,
        placeholder: '请选择',
        prompt: '请选择',
        value: null,
        type: 'text',
        options: [
          {
            label: '测试员',
            value: 1
          },
          {
            label: 'jedytest',
            value: 2
          },
          {
            label: '档案管理员',
            value: 3
          }
        ],
        state: {
          changeParams: [{ name: 'label' }], //选中后去选中参数的值一起提交
          changeAuto: {
            //联动控制同级组件，数据为选中的数据进行赋值
            name22: {
              option: 'state.params',
              value: [{ name: 'label' }] //动态赋值为字符串的时候直接取选择数据里面的值，为数组可取多个值赋值给option指向的key
            },
            name4: {
              option: 'value',
              value: 'value' //动态赋值为字符串的时候直接取选择数据里面的值，为数组可取多个值赋值给option指向的key
            }
          },
          initKeys: 'name22' //需要初始化的key可以是数组
          // changeOptions: {
          //   default: [getMenNum('name22', 'state.params', { name: '测试员' })],
          //   1: [getMenNum('name22', 'state.params', { name: '测试员' })],
          //   2: [getMenNum('name22', 'state.params', { name: 'jedytest' })],
          //   3: [getMenNum('name22', 'state.params', { name: '档案管理员' })]
          // }
        }
      }),
      new SelectQuestion({
        key: 'name22',
        label: '作业类型',
        required: true,
        placeholder: '请选择',
        prompt: '请选择',
        value: null,
        type: 'text',
        options: [],
        state: {
          url: 'system/role/list',
          nameKey: 'name',
          nameValue: 'id',
          protType: 'post',
          params: {}
        }
      }),
      new SelectQuestion({
        key: 'name3',
        label: '关联单号',
        required: true,
        placeholder: '请选择',
        prompt: '请选择',
        value: null,
        type: 'text',
        options: [
          {
            label: 'Doke1',
            value: 1
          },
          {
            label: 'Doke2',
            value: 2
          },
          {
            label: 'Doke3',
            value: 3
          }
        ]
      }),

      new SelectQuestion({
        key: 'code11',
        label: '控制故障维修',
        placeholder: '请输入故障部位',
        type: 'text',
        options: [
          {
            label: '需要备注',
            value: 0
          },
          {
            label: '不需要备注',
            value: 1
          }
        ],
        value: 0,
        state: {
          changeOptions: {
            0: [getMenNum('name4', 'hidden', false)],
            1: [getMenNum('name4', 'hidden', true)]
          }
        }
      }),

      new TimeQuestion({
        key: 'startTime',
        label: '维修开始时间',
        value: '',
        type: 'alone',
        required: true,
        state: {
          showTime: true,
          format: 'YYYY-MM-DD HH:mm:ss',
          valueFormat: 'YYYY-MM-DD HH:mm:ss'
        },
        order: 1
      }),

      new InputQuestion({
        key: 'name4',
        label: '备注',
        required: true,
        placeholder: '请输入备注',
        prompt: '请选择',
        value: null,
        type: 'textarea'
      }),

      new InputQuestion({
        key: 'name55',
        label: '使用年限',
        required: true,
        placeholder: '请输入备注',
        prompt: '请选择',
        value: null,
        type: 'text',
        state: {
          extendParams: {
            valName55: 1
          },
          addonAfter: {
            key: 'valName55',
            tagType: 'select',
            type: 'dictionary',
            filterName: 'DATE_UNIT',
            options: []
          }
        }
      }),

      new CustomTableQuestion({
        key: 'customTable',
        label: '维修费用',
        value: [
          {
            name1: '',
            name2: '',
            name3: '',
            name4: '',
            name5: '',
            name6: ''
          }
        ],
        type: 'text',
        state: {
          title: '备件清单',
          grid: 24,
          // fullLine: true, //占整行
          isAdd: true,
          text: '添加备件',
          // widthTable: '500px',
          rowSelection: {
            //选择功能的配置
            type: 'checkbox' //多选/单选 ：checkbox/radio
          },
          selectedRowKeys: [],
          columns: [
            {
              title: '行号',
              type: 'index'
            },
            {
              title: '备品名称',
              key: 'name2',
              required: true,
              prompt: '不能为空',
              type: 'select',
              options: [
                {
                  value: 'jack',
                  label: 'Jack'
                },
                {
                  value: 'lucy',
                  label: 'Lucy'
                }
              ],
              width: 250
            },
            {
              title: '备件编码',
              key: 'name3'
            },
            {
              title: '类型',
              key: 'name4'
            },
            {
              title: '品牌',
              key: 'name5',
              required: true,
              type: 'time'
            },
            {
              title: '规格型号',
              key: 'name6'
            },
            {
              title: '手机号',
              key: 'name7',
              // reg: regExp.phone,
              prompt: '请填写正确的手机格式',
              // type: 'number',
              width: '150px'
            },
            {
              title: '单位',
              key: 'name8'
            },
            {
              title: '操作',
              type: 'operation',
              handle: [
                {
                  type: 'delete',
                  text: '删除'
                },
                {
                  type: 'layerTable',
                  text: '详情1',
                  form: [],
                  params: [{ id: 'id' }],
                  table: this.getTables(),
                  config: {
                    title: '详情2',
                    style: 'table-form',
                    queryUrl: 'Course/GetAll',
                    rowKey: 'id',
                    name: 'layerTable',
                    params: {},
                    data: [
                      {
                        id: 1,
                        name1: '课程1',
                        name2: '张三',
                        name3: 1,
                        name4: 1663139464524,
                        name5: 1663139464524,
                        name6: 1663139464524,
                        name7: 1
                      },
                      {
                        id: 2,
                        name1: '课程1',
                        name2: '张三',
                        name3: 2,
                        name4: 1663139464524,
                        name5: 1663139464524,
                        name6: 1663139464524,
                        name7: 2
                      }
                    ]
                  }
                }
              ],
              width: 200
            }
          ]
        },
        order: 1
      }),

      new CustomTableQuestion({
        key: 'customTable2',
        label: '',
        value: [
          {
            name1: '',
            name2: '',
            name3: '',
            name4: '',
            name5: '',
            name6: ''
          }
        ],
        type: 'text',
        state: {
          title: '备件清单',
          grid: 24,
          fullLine: true, //占整行
          isAdd: true,
          text: '添加耗材',
          columns: [
            {
              title: '行号',
              type: 'index'
            },
            {
              title: '耗材名称',
              key: 'name2',
              type: 'select',
              options: [
                {
                  value: 'jack',
                  label: 'Jack'
                },
                {
                  value: 'lucy',
                  label: 'Lucy'
                }
              ],
              width: 250
            },
            {
              title: '备件编码',
              key: 'name3'
            },
            {
              title: '类型',
              key: 'name4'
            },
            {
              title: '品牌',
              key: 'name5'
            },
            {
              title: '规格型号',
              key: 'name6'
            },
            {
              title: '申请数量',
              key: 'name8',
              type: 'number',
              width: '150px'
            },
            {
              title: '单位',
              key: 'name9'
            },
            {
              title: '操作',
              type: 'operation',
              width: 100
            }
          ]
        },
        order: 1
      })
    ];
    return questions;
  }

  getLayerQuestions() {
    const questions: QuestionBase<any>[] = [
      new InputQuestion({
        key: 'name2',
        label: '备品名称',
        value: '',
        type: 'static',
        order: 1
      }),

      new InputQuestion({
        key: 'name3',
        label: '备件编码',
        value: '',
        type: 'static',
        order: 1
      }),

      new InputQuestion({
        key: 'name4',
        label: '类型',
        value: '',
        type: 'static',
        order: 1
      }),

      new InputQuestion({
        key: 'name5',
        label: '品牌',
        value: '',
        type: 'static',
        order: 1
      }),

      new InputQuestion({
        key: 'name6',
        label: '规格型号',
        value: '',
        type: 'static',
        order: 1
      }),

      new InputQuestion({
        key: 'name7',
        label: '手机号',
        value: '',
        type: 'static',
        order: 1
      }),

      new InputQuestion({
        key: 'name8',
        label: '单位',
        value: '',
        type: 'static',
        order: 1
      })
    ];

    return questions.sort((a, b) => a.order - b.order);
  }
}

export default new HomeService();
